package com.huang.A02_constructor;

public class Student {
    private String name;
    private int age;

    public void setAge(int age){
        if(age >= 0 && age <= 100){
            this.age = age;
        }else {
            System.out.println("您输入的年龄不合法");
        }
    }

    public int getAge(){
        return age;
    }

    public Student(){
        System.out.println("无参构造器执行了");
    }

    public Student(String name, int age){
        System.out.println("有参构造器执行了");
        this.name = name;
        this.age = age;
    }
}